package spring.cloud.eurekaclientfund.openfeign.config;

//import feign.Feign;
//import feign.Logger;
//import feign.RequestInterceptor;
//import feign.codec.Decoder;
//import org.springframework.beans.factory.ObjectFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.ConfigurableBeanFactory;
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.cloud.openfeign.support.SpringDecoder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Scope;
//import spring.cloud.eurekaclientfund.interceptor.UserInterceptor;
//
//public class UserFeignConfig {
//
//    //注入Springmvc消息转换器工厂
//    @Autowired
//    private ObjectFactory<HttpMessageConverters> messageConverters = null;
//
//    //解码器
//    @Bean(name = "feignDecoder")
//    //设置为 "prototype",代表只对当前客户端使用,如果在全局上使用请注释折行代码
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    public Decoder clientDecoder(){
//        return new SpringDecoder(messageConverters);
//    }
//
//
//    //拦截器
//    @Bean
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    public RequestInterceptor requestInterceptor(){
//        return new UserInterceptor();
//    }
//
//    //日志级别
//    @Bean
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    Logger.Level loggerLevel(){
//        return Logger.Level.FULL;
//    }
//
//
//    //创建客户端构建器 作为局部使用
//    //Feign.Builder构造器  而Hystrix需要的是HystrixFeign.Builder构造器 所以hystrix是不会生效的
//    @Bean(name = "feignBuilder")
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    public Feign.Builder clientBuiler(){
//        return Feign.builder();
//    }
//}
